package com.canal.admin.controller;

import com.canal.admin.response.Result;
import com.canal.admin.response.ResultUtil;
import com.canal.admin.service.HistoryDataService;
import com.canal.admin.transfer.req.data.CanalHiConditions;
import com.canal.admin.transfer.req.data.HistoryDataConditions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 历史数据
 * @author yangbo
 * @date 2020-07-22 21:01
 * @description
 * @since
 */
@RestController
public class HistoryDataController {

    @Autowired
    private HistoryDataService historyDataService;

    /**
     * 历史数据列表查询
     * @param conditions
     * @return
     */
    @PostMapping(value = "/st/list")
    @PreAuthorize("isAuthenticated()")
    public Result historyStData(@RequestBody HistoryDataConditions conditions) {
        return ResultUtil.makeSuccess(historyDataService.historyList(conditions));
    }

    /**
     * 渠道历史数据
     * @param conditions
     * @return
     */
    @PostMapping(value = "/st/canal/list")
    @PreAuthorize("isAuthenticated()")
    public Result canalHiList(@RequestBody CanalHiConditions conditions) {
        return ResultUtil.makeSuccess(historyDataService.canalHistoryList(conditions));
    }
}
